using NUnit.Framework;
using SharpTestsEx;

namespace AltNetHispano.Vale.Tests.Example
{
	public class AddressCrudServiceTest
	{
		private IValidator validator;
		[TestFixtureSetUp]
		public void ConfigureValidator()
		{
			validator = new Validator();
			validator.Register<Address>(p => validator.StringIsRequired("City", p.City));
		}

		[Test]
		public void WhenInvalidWithDefaultValuesThenReturnInvalidMessagges()
		{
			var service = new AddressCrudService(validator);
			var person = new Address { City = null };
			var invalidMessages = service.Save(person);
			invalidMessages.Should().Contain("City is required.");
		}
	}
}